//
//  UIBarButtonItem+Category.swift
//  SwiftWeiBo
//
//  Created by wyw on 16/9/17.
//  Copyright © 2016年 Style_Y. All rights reserved.
//

import UIKit

extension UIBarButtonItem
{
    class func creatBarButtonItem(imageName:String, target:AnyObject?, action:Selector) -> UIBarButtonItem {
        let btn = UIButton()
        btn.setImage(UIImage.init(named: imageName), for: UIControlState.normal)
        btn.setImage(UIImage.init(named: imageName + "_highlighted"), for: UIControlState.highlighted)
        btn.sizeToFit()
        btn.addTarget(target, action: action, for: UIControlEvents.touchUpInside)
        return UIBarButtonItem(customView: btn)
    }
}
